package liming.tool.runnable;

import liming.tool.runnable.HaveReturnValueInterface;
import liming.tool.runnable.NoReturnValueInterface;

public class HandRunnable {
    public static void run(NoReturnValueInterface runnable){
        try {
            runnable.run();
        } catch (Exception e) {
            runnable.onException(e);
        }
    }
    public static <T> T run(HaveReturnValueInterface<T> runnable){
        try {
            return runnable.run();
        } catch (Exception e) {
            return runnable.onException(e);
        }
    }
}
